package cn.cau.epidemicsurveysystem.service.impl;

import cn.cau.epidemicsurveysystem.bean.AreaStatisticsBean;
import cn.cau.epidemicsurveysystem.bean.MonthStatisticsBean;
import cn.cau.epidemicsurveysystem.bean.WeekStatisticsBean;
import cn.cau.epidemicsurveysystem.dao.AreaStatisticsRepository;
import cn.cau.epidemicsurveysystem.dao.MonthStatisticsRepository;
import cn.cau.epidemicsurveysystem.dao.WeekStatisticsRepository;
import cn.cau.epidemicsurveysystem.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @projectName: gp2023
 * @package: cn.cau.epidemicsurveysystem.service.impl
 * @className: StatisticsServiceImpl
 * @author: zy
 * @description: TODO
 * @date: 2022/3/3 16:12
 * @version: 1.0
 */
@Service
public class StatisticsServiceImpl implements StatisticsService {
    @Autowired
    WeekStatisticsRepository weekRepository;

    @Autowired
    MonthStatisticsRepository monthRepository;

    @Autowired
    AreaStatisticsRepository areaRepository;

    @Override
    public List<WeekStatisticsBean> findWeekStatisticsByCntAndType(int cnt, int type) {
        return weekRepository.findWeekStatisticsBeansByCntEqualsAndTypeEqualsOrderByWeekdayAsc(cnt,type);
    }

    @Override
    public List<MonthStatisticsBean> findMonthStatisticsByYearAndType(int year, int type) {
        return monthRepository.findMonthStatisticsBeansByYearEqualsAndTypeEqualsOrderByMonthAsc(year,type);
    }

    @Override
    public List<AreaStatisticsBean> findAreaStatisticsByType(int type) {
        return areaRepository.findAreaStatisticsBeansByTypeEquals(type);
    }
}
